home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 17
/
CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso
/
CUCD
/
Programming
/
DiceSource
/
src
/
dd
/
source.c.deleted
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-17
|
2KB
|
66 lines
#include "defs.h"
#include "dbug_protos.h"
// ************************************************************************
Prototype WORD RefreshSource(WORD maxLines, BOOL fullRefresh);
// ************************************************************************
DEBUG *debug = FindDebug(windowTop);
SOURCE *source;
if (!debug) return FALSE;
source = FindSource(debug, windowTop);
while (source != debug->tableEnd) {
if (source->address != windowTop) {
windowTop = source->address;
RefreshWindow(TRUE);
return TRUE;
}
++source;
}
return FALSE;
}
WORD RefreshSource(WORD maxLines, BOOL fullRefresh) {
ULONG address = windowTop;
WORD count = 0;
char *line, *lineEnd;
SOURCE *source, *nextSource;
DEBUG *debug;
ULONG lineNum;
if (maxLines) {
ScrPuts("\x9b0m\x9b7mSOURCE MODE");
count++; Newline(); maxLines--;
}
debug = FindDebug(address);
if (!debug || !debug->source) return count;
source = FindSource(debug, address);
while (maxLines > 0 && source != debug->tableEnd) {
address = source->address;
nextSource = &source[1];
if (address == programPC) ScrHighlight();
if (IsBreakpoint(address)) ScrItalics();
line = FindSourceLine(debug, source);
windowBottom = address;
lineNum = source->lineNumber;
while (maxLines > 0) {
lineEnd = line;
while (*lineEnd && *lineEnd != '\n') lineEnd++;
ScrPrintf("%6d. ", lineNum); // PrintAddress(address);
ScrWrite(line, lineEnd-line);
line = lineEnd;
if (*line) line++; else return count;
Newline(); count++; maxLines--;
lineNum++; if (nextSource != debug->tableEnd && lineNum >= nextSource->lineNumber) break;
}
source = nextSource;
}
return count;
}